<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>角色管理</title>
    <%@ include file="../../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
</head>
<script>
    var statusEnumMap = '${statusEnumMap}';
    var searchInfo = '${searchInfo}';
</script>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-search"></i> 筛选查询</h5>
                </div>
                <div class="ibox-content ibox-content-search">
                    <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate"
                          action="${ctx}/pfRole/getGridData"  method="post">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">查询角色：</label>
                            <div class="col-sm-5">
                                 <input type="text" name="roleName" value="${not empty searchInfo ? searchInfo.roleName : ''}"  id="roleName" class="form-control" onkeydown="if(event.keyCode==13){doRefresh();return false;}"
                                            placeholder="输入角色名称" maxlength="20">
                            </div>
                            <label class="col-sm-1 control-label">状态：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="status" id="status"  onchange="doRefresh()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${statusEnumMap}" var="item">
                                        <c:if test="${item.key!='delete'}">
                                            <option value="${item.key}" ${not empty searchInfo && searchInfo.status == item.key ? 'selected' : '' } >${item.value}</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                            </div>
                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                                <c:if test="${userType == 'super' or userType == 'sysadmin' }">
                                <button type="button" class="btn btn-primary btn-outline" onclick="openSearchTools();"><i class="fa fa-caret-down"></i></button>
                                </c:if>
                                </div>
                        </div>
                        <c:if test="${userType == 'super' or userType == 'sysadmin' }">
                            <div class="search-tools">
                                <div class="form-group">
                                    <label class="col-sm-1 control-label">服务商：</label>
                                    <div class="col-sm-5">
                                        <div class="input-group">
                                            <input type="hidden" value="${not empty searchInfo ? searchInfo.isvPid : ''}" id="isvPid" name="isvPid">
                                            <input type="text" id="isvName" name="isvName" value="${not empty searchInfo ? searchInfo.isvName : ''}" class="form-control" placeholder="输入服务商">
                                            <div class="input-group-btn" style="width: 0px;">
                                                <button type="button" class="btn btn-default dropdown-toggle mySearchBtn" data-toggle="dropdown">
                                                    <span class="caret"></span>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </c:if>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-table"></i> 角色信息</h5>
                    <div class="ibox-tools col-sm-offset-4">
                        <c:if test="${userType == 'super' || not empty btnMap['addRole']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditPage('add')">新建</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editRole']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditPage('edit')">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['stateRole']}">
                            <button class="btn btn-primary btn-outline change_text" onclick="changeState()">冻结</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delRole']}">
                            <button class="btn btn-primary btn-outline" onclick="deleteRole()">删除</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['setTabRef']}">
                            <button class="btn btn-primary btn-outline" onclick="openSetTabPage()">TAB页权限</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['setBtnRef']}">
                            <button class="btn btn-primary btn-outline" onclick="openSetBtnPage()">按钮权限</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" onclick="doRefresh()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content ibox-content-table">
                    <table data-toggle="table"   id="dataTable"  data-height="400"
                           data-pagination="true" data-side-pagination="server" data-striped="true"
                           data-url="${ctx}/pfRole/getGridData?t=${now}" data-response-handler="handleServerResult" data-query-params-type="" data-query-params="getParams"
                           data-cache="true"
                           data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                           data-page-size="${not empty searchInfo.pageSize ? searchInfo.pageSize : defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <%--<th data-field="id" data-width="80px" data-align="center">角色ID</th>--%>
                            <th data-field="status" data-formatter="formatStatus" data-width="80px" data-align="center" >状态</th>
                            <th data-field="roleName" data-align="center" data-formatter="formatName"  data-events="actionEvents" >角色名称</th>
                                <c:if test="${userType != 'isvadmin'.toString() && userType != 'isvcomm'.toString()}">
                                    <th data-field="isvName" data-align="center" data-events="actionEvents" >服务商</th>
                                </c:if>
                           <th data-field="sortNum" data-align="center">排序</th>
                            <th data-field="creator" data-align="center"  data-width="150px" data-formatter="formatterCreator" >创建人</th>
                            <th data-field="operator" data-width="120px"  data-align="center" data-formatter="formatterOperator" >编辑人</th>

                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">${companyName}</div>
        </div>
    </div>
</div>
<script src="${ctx}/js/sys/role/pfRoleMgr.js?t=${now}"></script>
</body>
</html>
